const mongoose=require('mongoose');
const moment=require('moment');

const UserSchema = new mongoose.Schema({
    username:String,
    password:String,
    avatar:{
        type:String,
        default:'1.png'
    },
    //注册时间
    regTime:Date,
    githubId:String
});

UserSchema.virtual('regTimeStr').get(function (){
    return moment(this.regTime).format('YYYY-MM-DD HH:mm:ss');
});

module.exports=mongoose.model('User',UserSchema);